<template>
  <!-- 整体容器 -->
  <div class="job-board-container">
    <!-- 顶部导航区域 -->
    <header class="top-nav">
      <div class="nav-inner">
        <div class="left-section">
          <div class="tab recommend-tab" :class="{ active: currentTab === '推荐' }" @click="currentTab = '推荐'">推荐</div>
          <div class="divider">|</div>
        </div>

        <div class="search-section">
          <el-input
            v-model="query.keyword"
            placeholder="搜索职位、公司"
            clearable
            class="search-input"
            prefix-icon="Search"
            @keyup.enter="handleSearch"
          />
          <el-button class="map-btn" @click="openMap">
            <el-icon class="map-icon"><Location /></el-icon>
            地图
          </el-button>
          <el-button type="primary" class="search-btn" @click="handleSearch">搜索</el-button>
        </div>
      </div>
    </header>

    <!-- 筛选条件区域 -->
    <div class="filter-bar">
      <div class="filter-inner">
        <div class="city-picker">
          <!-- 触发按钮 -->
          <el-button
            type="link"
            @click="openCityDialog"
            class="current-city"
          >
            {{ currentCity || '全国' }}
            <el-icon class="arrow-icon"><ArrowDown /></el-icon>
          </el-button>
        </div>
        <div class="filter-item">
          <el-select
            v-model="query.type"
            placeholder="求职类型"
            clearable
            class="filter-select"
            @change="handleSearch"
          >
            <!-- <el-option :key="0" label="不限" value="0" /> -->
            <el-option :key="1" label="兼职" value="1" />
            <el-option :key="2" label="全职" value="2" />
          </el-select>
        </div>

        <div class="filter-item">
          <el-select
            v-model="query.working"
            placeholder="工作经验"
            clearable
            class="filter-select"
            @change="handleSearch"
          >
            <!-- <el-option :key="0" label="经验不限" value="0" /> -->
            <el-option :key="1" label="在校生" value="1" />
            <el-option :key="2" label="应届生" value="2" />
            <el-option :key="3" label="1-3年" value="3" />
            <el-option :key="4" label="3-5年" value="4" />
            <el-option :key="5" label="5年以上" value="5" />
          </el-select>
        </div>

        <div class="filter-item">
          <el-select
            v-model="query.education"
            placeholder="学历要求"
            clearable
            class="filter-select"
            @change="handleSearch"
          >
            <!-- <el-option :key="0" label="不限" value="不限" /> -->
            <el-option :key="1" label="初中及以下" value="初中及以下" />
            <el-option :key="2" label="中专" value="中专" />
            <el-option :key="3" label="高中" value="高中" />
            <el-option :key="4" label="大专" value="大专" />
            <el- option :key="5" label="本科" value="本科" />
            <el-option :key="6" label="硕士" value="硕士" />
            <el-option :key="7" label="博士" value="博士" />
          </el-select>
        </div>

        <div class="filter-item clear-btn">
          <el-button type="link" @click="clearFilters">清空</el-button>
        </div>
      </div>
    </div>

    <!-- 城市弹框 -->
    <el-dialog
      v-model="dialogVisible"
      title="请选择城市"
      width="500px"
      :close-on-click-modal="true"
    >
      <!-- Tabs 导航 -->
      <el-tabs
        v-model="activeTab"
        class="city-tabs"
        @tab-click="handleTabClick"
      >
        <el-tab-pane label="热门城市" name="hot"></el-tab-pane>
        <el-tab-pane label="ABCDE" name="A"></el-tab-pane>
        <el-tab-pane label="FGHJ" name="F"></el-tab-pane>
        <el-tab-pane label="KLMN" name="K"></el-tab-pane>
        <el-tab-pane label="PQRST" name="P"></el-tab-pane>
        <el-tab-pane label="WXYZ" name="W"></el-tab-pane>
      </el-tabs>

      <!-- 城市列表 -->
      <div class="city-list">
        <div
          v-for="(city, index) in filteredCities"
          :key="index"
          class="city-item"
          @click="selectCity(city)"
        >
          {{ city }}
        </div>
      </div>
    </el-dialog>

    <!-- 主容器：左右分栏 -->
    <div class="dashboard">
      <!-- 左侧列表 -->
      <div class="sidebar">
        <!-- 职位列表 -->
        <div class="job-list" v-if="jobLists.length > 0">
          <div
            v-for="(job, index) in jobLists"
            :key="job.id"
            class="job-card"
            :class="{ 
              'active-job': selectedJobId === job.id,
              'hover-scale': isHoveringIndex === index 
            }"
            @mouseenter="handleMouseEnter(index)"
            @mouseleave="handleMouseLeave(index)"
            @click="selectJob(job.id, index)"
          >
            <div class="job-info">
              <div class="job-header">
                <h3 class="job-title">{{ job.title }}</h3>
                <span class="salary-tag">{{ job.money }}</span>
              </div>
              <div class="job-meta">
                <span class="meta-item">
                  <el-icon class="meta-icon"><School /></el-icon>
                  {{ job.education }}
                </span>
                <span class="meta-item">
                  <el-icon class="meta-icon"><CollectionTag /></el-icon>
                  {{ job.label || '暂无标签' }}
                </span>
              </div>
              <div class="company-info">
                <img
                  :src="job.company.logo || 'https://picsum.photos/100/100'"
                  alt="Company Logo"
                  class="company-logo"
                />
                <div class="company-details">
                  <div class="company-name ellipsis">{{ job.company.name }}</div>
                  <div class="company-desc ellipsis">{{ job.company.description }}</div>
                </div>
              </div>
              <!-- 定位城市信息 -->
              <div class="location-info">
                <el-icon class="location-icon"><Location /></el-icon>
                <span class="city-text">{{ job.city.name || job.city }}</span>
              </div>
            </div>
          </div>
        </div>

        <!-- 无数据状态 -->
        <div v-else class="no-data">
          <el-empty description="没有找到匹配的职位" />
        </div>
      </div>

      <!-- 右侧详情 -->
      <div class="main">
        <!-- 无选中状态 -->
        <div v-if="!selectedJob" class="empty-state">
          <el-empty description="请选择一个职位查看详情" />
        </div>

        <!-- 详情内容 -->
        <div v-else class="detail">
          <!-- 顶部提示 -->
          <div class="top-banner">
            <div class="banner-content">
              <div class="banner-text">
                <h3 class="banner-title">完善信息提醒</h3>
                <p class="banner-desc">完善基础信息，推荐更准确岗位</p>
              </div>
              <el-button type="primary" size="small">完善简历</el-button>
            </div>
          </div>

          <!-- 职位头部 -->
          <div class="detail-header">
            <div class="header-left">
              <h1 class="job-title">{{ selectedJob.title }}</h1>
              <div class="salary-box">
                <span class="salary-value">{{ selectedJob.money }}</span>
              </div>
              <div class="meta-info">
                <span class="meta-item">
                  <el-icon class="meta-icon"><Location /></el-icon>
                  {{ selectedJob.city.name || selectedJob.city }}
                </span>
                <span class="meta-item">
                  <el-icon class="meta-icon"><School /></el-icon>
                  {{ selectedJob.education }}
                </span>
                <span class="meta-item">
                  <el-icon class="meta-icon"><CollectionTag /></el-icon>
                  {{ selectedJob.label || '暂无标签' }}
                </span>
              </div>
            </div>
            <div class="header-right">
              <el-button type="success" icon="Star" size="small">点击收藏</el-button>
              <el-button type="primary" icon="Message" size="small">立即沟通&ensp;&ensp;</el-button>
            </div>
          </div>

          <!-- 职位描述 -->
          <div class="section">
            <h2 class="section-title">职位描述</h2>
            <div class="tags">
              <el-tag v-for="tag in [selectedJob.education, selectedJob.company.name, selectedJob.job_category]" :key="tag" type="info" size="small">
                {{ tag }}
              </el-tag>
            </div>
            <div class="desc-content">
              <div class="desc-item">工作周期：{{ selectedJob.work_period || '长期兼职' }}</div>
              <div class="desc-item">每周工期：{{ selectedJob.weekly_duration || '5天及以上' }}</div>
              <div class="desc-item">工作时间：{{ selectedJob.work_time || '不限' }}</div>
              <div class="desc-item">工作时段：{{ selectedJob.work_period || '早九晚五' }}</div>
              <div class="desc-item">结算方式：{{ selectedJob.settlement || '月结' }}</div>
              <div class="desc-item">招聘截止时间：{{ selectedJob.deadline || '2025-12-31' }}</div>
              <div class="desc-item">要求：{{ selectedJob.requirements || '18-35周岁' }}</div>
              <div class="salary-benefits">
                <div class="desc-item">薪资待遇：</div>
                <div class="desc-item">每月：{{ selectedJob.money }}</div>
                <div class="desc-item">全勤奖：500</div>
                <div class="desc-item">本工作全程不会收取任何费用，放心咨询。ps:收费的都是骗子</div>
              </div>
            </div>
          </div>

          <!-- HR信息 -->
          <div class="section">
            <h2 class="section-title">HR信息</h2>
            <div class="hr-info">
              <img
                :src="selectedJob.hr.aveter || 'https://picsum.photos/100/100'"
                alt="HR Avatar"
                class="hr-avatar"
              />
              <div class="hr-details">
                <div class="hr-name">
                  <span class="hr-name-text">{{ selectedJob.hr.name }}</span>
                </div>
                <div class="hr-name">
                  <span class="hr-department">{{ selectedJob.hr.work_number }}</span>
                </div>
                <div class="hr-name">
                  <span class="hr-name-text">{{ selectedJob.hr.department }}</span>
                  <sapn>&nbsp; &nbsp; </sapn>
                  <span class="hr-department">{{ selectedJob.hr.position }}</span>
                </div>
              </div>
            </div>
          </div>

          <!-- 公司信息 -->
          <div class="section">
            <h2 class="section-title">公司信息</h2>
            <div class="company-info">
              <img
                :src="selectedJob.company.logo || 'https://picsum.photos/100/100'"
                alt="Company Logo"
                class="company-logo-lg"
              />
              <div class="company-text">
                <div class="company-name-lg">{{ selectedJob.company.name }}</div>
                <div class="company-desc-lg">{{ selectedJob.company.description }}</div>
                <div class="company-location">
                  <el-icon class="meta-icon"><Location /></el-icon>
                  {{ selectedJob.company.location }}
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup>
import {
  Location,
  School,
  CollectionTag,
  Star,
  Message,
  Search
} from '@element-plus/icons-vue';
import { ElEmpty, ElTag, ElButton, ElIcon } from 'element-plus';
import { ref, computed, onMounted } from 'vue';
import axios from "axios";
import { ArrowDown } from '@element-plus/icons-vue';
import { useRoute } from 'vue-router';

// 路由相关
const route = useRoute();

// 数据状态
const jobLists = ref([]);
const isHoveringIndex = ref(-1);
const selectedJobId = ref(null);
const selectedJob = ref(null);
const currentTab = ref('推荐');
const searchTimer = ref(null);

// 搜索参数
const query = ref({
  keyword: "",
  city: "",
  type: null,
  working: null,
  education: ""
});

// 城市选择相关
const cityData = {
  hot: ['全国', '北京', '上海', '广州', '深圳', '杭州', '天津', '西安', '苏州', '武汉', '厦门', '长沙', '成都', '郑州', '重庆'],
  A: ['安庆', '鞍山', '安阳'],
  F: ['福州', '佛山', '抚顺'],
  K: ['昆明', '开封', '喀什'],
  P: ['莆田', '平顶山', '濮阳'],
  W: ['无锡', '温州', '武汉']
};

const currentCity = ref('');
const dialogVisible = ref(false);
const activeTab = ref('hot');

// 计算属性：过滤城市列表
const filteredCities = computed(() => {
  return cityData[activeTab.value] || [];
});

// 鼠标事件处理
const handleMouseEnter = (index) => {
  isHoveringIndex.value = index;
};

const handleMouseLeave = () => {
  isHoveringIndex.value = -1;
};

// 职位选择
const selectJob = (id, index) => {
  selectedJobId.value = id;
  // 查找选中职位详情
  selectedJob.value = jobLists.value.find(job => job.id === id) || null;
  
  // 平滑滚动到选中项
  const item = document.querySelectorAll('.job-card')[index];
  if (item) {
    item.scrollIntoView({ behavior: 'smooth', block: 'nearest' });
  }
};

// 城市选择相关方法
const openCityDialog = () => {
  dialogVisible.value = true;
};

const handleTabClick = (tab) => {
  activeTab.value = tab.name;
};

const selectCity = (city) => {
  currentCity.value = city;
  dialogVisible.value = false;
  query.value.city = city;
  handleSearch(); // 选择城市后触发搜索
};

// 清空筛选条件
const clearFilters = () => {
  query.value = {
    keyword: "",
    city: "",
    type: null,
    working: null,
    education: ""
  };
  currentCity.value = "";
  handleSearch();
};

// 地图打开方法
const openMap = () => {
  // 实现地图打开逻辑
  console.log('打开地图');
};

// 处理搜索逻辑
const handleSearch = () => {
  // 有关键词时使用新的搜索接口
  if (query.value.keyword.trim()) {
    searchJobs();
  } else {
    // 没有关键词时使用旧的列表接口
    getJobList();
  }
};

// 调用旧的职位列表接口（无关键词时使用）
const getJobList = () => {
  clearTimeout(searchTimer.value);
  searchTimer.value = setTimeout(() => {
    const cityParam = currentCity.value || "";
    
    axios.get("http://127.0.0.1:8000/home/jobList/", {
      params: {
        ...query.value,
        city: cityParam
      }
    })
    .then(res => {
      if (res.status === 200) {
        jobLists.value = res.data.data;
        
        if (jobLists.value.length > 0) {
          // 有数据时，选中第一条
          selectJob(jobLists.value[0].id, 0);
        } else {
          // 无数据时，清空选中的职位
          selectedJob.value = null;
        }
      } else {
        ElMessage.error(res.data.msg || '获取职位数据失败');
      }
    })
    .catch(err => {
      ElMessage.error('网络异常，请重试');
      console.error('请求职位数据失败：', err);
    });
  }, 300);

};

// 调用新的搜索接口（有关键词时使用）
const searchJobs = () => {
  clearTimeout(searchTimer.value);
  searchTimer.value = setTimeout(() => {
    let keyword = query.value.keyword.trim();
    
    if (!keyword) {
      ElMessage.warning('请输入搜索关键词');
      return;
    }
    
    // 准备请求数据
    const requestData = {
      keyword: keyword,
    };
    
    // 调用后端搜索接口
    axios.post('http://127.0.0.1:8000/home/filt/', requestData)
      .then(res => {
        if (res.data.status === 'success') {
          jobLists.value = res.data.data;
          
          if (jobLists.value.length > 0) {
            selectJob(jobLists.value[0].id, 0);
          } else {
            selectedJob.value = null;
            ElMessage.info('未找到匹配的职位');
          }
        } else {
          ElMessage.error(res.data.message || '搜索失败');
        }
      })
      .catch(err => {
        console.error('搜索接口请求失败:', err);
        ElMessage.error('网络错误，搜索失败');
      });
  }, 300);
};

// 页面加载时处理
onMounted(() => {
  // 从路由参数中获取搜索关键词
  const keyword = route.query.keyword || '';
  if (keyword) {
    query.value.keyword = keyword;
    // 调用新的搜索接口
    searchJobs();
  } else {
    // 如果没有搜索参数，加载默认数据
    getJobList();
  }
});
</script>
<style scoped>
/* 基础样式 */
.job-board-container {
  font-family: 'PingFang SC', 'Helvetica Neue', Arial, sans-serif;
  color: #333;
  background-color: #f8f9fa;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* 顶部导航 */
.top-nav {
  background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
  color: #fff;
  padding: 16px 0;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  width: 100%;
}

.nav-inner {
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 24px;
  box-sizing: border-box;
}

.left-section {
  display: flex;
  padding-top: 35px;
  align-items: center;
  gap: 16px;
}

.tab {
  cursor: pointer;
  padding: 8px 16px;
  border-radius: 20px;
  transition: all 0.3s ease;
  font-weight: 500;
}

.tab.active {
  background-color: rgba(255, 255, 255, 0.2);
}

.divider {
  color: rgba(255, 255, 255, 0.3);
}

.search-section {
  display: flex;
  align-items: center;
  padding-top: 40px;
  gap: 1px;
  flex: 1;
  max-width: 800px;
  margin: 0 20px;
}

.search-input {
  flex: 1;
  min-width: 200px;
  --el-input-bg-color: rgba(255, 255, 255, 0.9);
  --el-input-border-color: transparent;
  --el-input-hover-border-color: rgba(255, 255, 255, 0.8);
  border-radius: 20px;
  transition: all 0.3s ease;
}

.search-input:hover {
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.2);
}

.map-btn {
  background-color: rgba(255, 255, 255, 0.1);
  color: #fff;
  border: none;
  border-radius: 20px;
  transition: all 0.3s ease;
  padding: 10px 16px;
  white-space: nowrap;
}

.map-btn:hover {
  background-color: rgba(255, 255, 255, 0.2);
}

.search-btn {
  border-radius: 20px;
  padding: 10px 24px;
  font-weight: 500;
  white-space: nowrap;
}

/* 筛选栏 */
.filter-bar {
  background-color: #fff;
  padding: 16px 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  position: sticky;
  top: 0;
  z-index: 10;
  width: 100%;
}

.filter-inner {
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-sizing: border-box;
  overflow-x: auto;
  scrollbar-width: none; /* Firefox */
}

.filter-inner::-webkit-scrollbar {
  display: none; /* Chrome/Safari */
}

.current-city {
  color: #2575fc;
  font-weight: 500;
  padding: 0 12px;
  white-space: nowrap;
}

.filter-select {
  --el-select-bg-color: #fff;
  --el-select-border-color: #e1e5eb;
  --el-select-hover-border-color: #2575fc;
  border-radius: 20px;
  min-width: 120px;
  white-space: nowrap;
}

.clear-btn {
  margin-left: auto;
  white-space: nowrap;
}

.clear-btn .el-button {
  color: #666;
}

.clear-btn .el-button:hover {
  color: #2575fc;
}

/* 主内容区域 */
.dashboard {
  flex: 1;
  display: flex;
  gap: 24px;
  width: 100%;
  max-width: 100%;
  margin: 24px 0;
  padding: 0 24px;
  box-sizing: border-box;
}

/* 左侧边栏 */
.sidebar {
  width: 380px;
  min-width: 380px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
  overflow: hidden;
  height: calc(100vh - 200px);
  overflow-y: auto;
  position: sticky;
  top: 120px;
}

.sidebar::-webkit-scrollbar {
  width: 6px;
}

.sidebar::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 10px;
}

.sidebar::-webkit-scrollbar-thumb {
  background: #ddd;
  border-radius: 10px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
  background: #bbb;
}

.job-list {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.job-card {
  padding: 20px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid #e8e8e8;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.job-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(37, 117, 252, 0.1);
  border-color: #2575fc;
}

.job-card.active-job {
  border-color: #2575fc;
  background-color: #f5f9ff;
}

.job-card.active-job::after {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 3px;
  background-color: #2575fc;
}

.job-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.job-title {
  font-size: 16px;
  max-width: 200px;
  font-weight: 600;
  color: #333;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.salary-tag {
  font-size: 15px;
  font-weight: 600;
  color: #ff6b00;
  background-color: rgba(255, 107, 0, 0.1);
  padding: 4px 10px;
  border-radius: 10px;
}

.job-meta {
  color: #666;
  font-size: 13px;
  margin-bottom: 15px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 5px;
}

.meta-icon {
  color: #2575fc;
  font-size: 14px;
}

.company-info {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.company-logo {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid #f0f0f0;
}

.company-details {
  flex: 1;
  min-width: 0;
}

.company-name {
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.company-desc {
  font-size: 12px;
  color: #999;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.location-info {
  display: flex;
  align-items: center;
  font-size: 13px;
  color: #666;
}

.location-icon {
  color: #2575fc;
  margin-right: 4px;
}

.city-text {
  color: #666;
}

.no-data {
  padding: 40px 0;
}

/* 右侧主内容 */
.main {
  flex: 1;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
  overflow: hidden;
  height: calc(100vh - 200px);
  overflow-y: auto;
  position: sticky;
  top: 120px;
}

.main::-webkit-scrollbar {
  width: 6px;
}

.main::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 10px;
}

.main::-webkit-scrollbar-thumb {
  background: #ddd;
  border-radius: 10px;
}

.main::-webkit-scrollbar-thumb:hover {
  background: #bbb;
}

.empty-state {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100%;
  color: #999;
}

.detail {
  padding: 24px;
  animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.top-banner {
  background: linear-gradient(135deg, #f5f7fa 0%, #e4f0ff 100%);
  padding: 16px 24px;
  border-radius: 8px;
  margin-bottom: 24px;
  border-left: 4px solid #2575fc;
}

.banner-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.banner-text {
  max-width: 70%;
}

.banner-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 6px;
  color: #333;
}

.banner-desc {
  font-size: 14px;
  color: #666;
  margin: 0;
}

.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid #f0f2f5;
}

.header-left {
  flex: 1;
  margin-right: 20px;
}

.job-title {
  font-size: 24px;
  font-weight: 700;
  margin: 0 0 12px 0;
  color: #333;
  line-height: 1.3;
}

.salary-box {
  margin-bottom: 16px;
}

.salary-value {
  font-size: 22px;
  font-weight: 600;
  color: #ff6b00;
}

.meta-info {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  color: #666;
  font-size: 14px;
}

.header-right {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: fit-content;  /* 宽度自适应内容 */
}

/* 确保按钮本身也是自适应宽度 */
.header-right .el-button {
  width: auto;        /* 按钮宽度自适应 */
  min-width: unset;   /* 移除最小宽度限制（如果有） */
  padding-left: 12px; /* 根据需要调整左右内边距 */
  padding-right: 12px;
}

.section {
  margin-bottom: 32px;
}

.section-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid #f0f2f5;
  color: #333;
  position: relative;
}

.section-title::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 60px;
  height: 3px;
  background-color: #2575fc;
}

.tags {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.desc-content {
  line-height: 1.8;
  color: #555;
  font-size: 15px;
}

.desc-item {
  margin-bottom: 10px;
}

.salary-benefits {
  margin-top: 16px;
  padding-left: 16px;
  border-left: 2px solid #e0e6ed;
}

.hr-info {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background-color: #f9f9f9;
  border-radius: 8px;
}

.hr-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #e0e6ed;
}

.hr-details {
  flex: 1;
}

.hr-name {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 6px;
}

.hr-department {
  font-size: 14px;
  color: #666;
  margin-bottom: 4px;
}

.company-info {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  padding: 16px;
  background-color: #f9f9f9;
  border-radius: 8px;
}

.company-logo-lg {
  width: 100px;
  height: 100px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid #e0e6ed;
}

.company-text {
  flex: 1;
}

.company-name-lg {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
  color: #333;
}

.company-desc-lg {
  font-size: 14px;
  color: #666;
  margin-bottom: 12px;
  line-height: 1.6;
}

.company-location {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: #666;
}

/* 城市选择弹窗 */
.city-tabs {
  margin-bottom: 16px;
}

.city-list {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  max-height: 300px;
  overflow-y: auto;
  padding: 8px 0;
}

.city-item {
  width: calc(33.33% - 8px);
  padding: 8px 12px;
  text-align: center;
  cursor: pointer;
  color: #333;
  background-color: #fff;
  border: 1px solid #e8e8e8;
  border-radius: 6px;
  transition: all 0.3s ease;
}

.city-item:hover {
  background-color: #f5f9ff;
  border-color: #2575fc;
  color: #2575fc;
}

/* 响应式设计 */
@media (max-width: 1200px) {
  .dashboard {
    padding: 0 16px;
  }
  
  .sidebar {
    width: 320px;
    min-width: 320px;
  }
}

@media (max-width: 992px) {
  .dashboard {
    flex-direction: column;
  }
  
  .sidebar {
    width: 100%;
    min-width: 100%;
    height: auto;
    max-height: 400px;
    position: relative;
    top: auto;
  }
  
  .main {
    height: auto;
    position: relative;
    top: auto;
  }
  
  .nav-inner {
    flex-wrap: wrap;
    gap: 12px;
  }
  
  .search-section {
    order: 3;
    width: 100%;
    margin: 0;
  }
}

@media (max-width: 768px) {
  .nav-inner {
    padding: 0 16px;
  }
  
  .filter-inner {
    padding: 0 16px;
  }
  
  .dashboard {
    padding: 0 12px;
    gap: 16px;
  }
  
  .detail-header {
    flex-direction: column;
    gap: 16px;
  }
  
  .header-right {
    width: 100%;
    flex-direction: row;
    justify-content: flex-end;
  }
  
  .city-item {
    width: calc(50% - 6px);
  }
  
  .search-section {
    flex-wrap: wrap;
  }
  
  .search-input {
    min-width: 100%;
    order: 1;
  }
  
  .map-btn {
    order: 2;
  }
  
  .search-btn {
    order: 3;
    flex: 1;
  }
}

@media (max-width: 480px) {
  .nav-inner {
    padding: 0 12px;
  }
  
  .filter-inner {
    padding: 0 12px;
  }
  
  .dashboard {
    padding: 0 8px;
  }
  
  .detail {
    padding: 16px;
  }
  
  .job-card {
    padding: 16px;
  }
  
  .city-item {
    width: 100%;
  }
  
  .header-right .el-button {
    width: 100%;
  }
  
  .hr-info, .company-info {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .hr-avatar {
    width: 60px;
    height: 60px;
  }
  
  .company-logo-lg {
    width: 80px;
    height: 80px;
  }
}
</style>